package ru.ifmo.thesis.gp.configurations;

import org.jgap.InvalidConfigurationException;
import org.jgap.NaturalSelector;
import org.jgap.event.IEventManager;

import ru.ifmo.thesis.gp.MyConfigurationOptions;
import ru.ifmo.thesis.gp.MyMutationOperator;
import ru.ifmo.thesis.gp.MyOrderedCrossover;
import ru.ifmo.thesis.gp.RIGAOperator;
import ru.ifmo.thesis.quantities.Percent;

public class RIGAConfiguration extends BaseConfiguration {

	public RIGAConfiguration(MyConfigurationOptions options,
			IEventManager eventManager) {
		super(options, eventManager);
		doSetup(options, eventManager);
	}

	@Override
	protected NaturalSelector createNaturalSelector(
			MyConfigurationOptions options)
			throws InvalidConfigurationException {
		return tournamentSelectot();
	}

	@Override
	protected void setupGeneticOperators(MyConfigurationOptions options)
			throws InvalidConfigurationException {

		addGeneticOperator(new MyMutationOperator(this, options.getMutationPercent(),  options.getMovingsPerMutation()));
		addGeneticOperator(new RIGAOperator(this, new Percent(0.9)));
		addGeneticOperator(new MyOrderedCrossover(this, options.getCrossoverRate().value()));	
	}
	
	

}
